<?php

namespace App\IndexConfigurators;

use ScoutElastic\IndexConfigurator;
use ScoutElastic\Migratable;

class CommentDetailIndexConfigurator extends IndexConfigurator
{
    use Migratable;

    protected $name = 'huanbao_comment_details';
    /**
     * @var array
     */
    protected $defaultMapping = [
        'properties' => [
            'id' => [
                'type' => 'long',
            ],
            'cid' => [
                'type' => 'long',
            ],
            'type' => [
                'type' => 'long',
            ],
            'content' => [
                'type' => 'nested',
                'properties' => [
                    'type' => [
                        'type' => 'text',
                    ],
                    'data' => [
                        'properties' => [
                            'text' => [
                                'type' => 'text',
                                'analyzer' => 'ik_max_word',
                                'search_analyzer' => 'ik_smart',
                            ],
                            'key' => [
                                'type' => 'text',
                            ],
                            'format' => [
                                'type' => 'text',
                            ],
                            'width' => [
                                'type' => 'long',
                            ],
                            'height' => [
                                'type' => 'long',
                            ],
                            'url' => [
                                'type' => 'text',
                            ]
                        ],
                    ]
                ]
            ],
            'created_at' => [
                'type' => 'date',
                'format' => 'yyyy-MM-dd HH:mm:ss',
            ],
            'updated_at' => [
                'type' => 'date',
                'format' => 'yyyy-MM-dd HH:mm:ss',
            ],
            'deleted_at' => [
                'type' => 'date',
                'format' => 'yyyy-MM-dd HH:mm:ss',
            ],
        ]
    ];

    protected $settings = [

    ];
}